import axios from '@/libs/api.request'

export const getList = (params) => {
  return axios.request({
    url: 'Gift/index',
    method: 'get',
    params: params
  })
}

export const del = (params) => {
  return axios.request({
    url: 'Gift/del',
    method: 'get',
    params: params
  })
}

export const code = (params) => {
  return axios.request({
    url: 'Gift/code',
    method: 'get',
    params
  })
}

/**
 * 导出礼包码
 * @param data
 * @returns {wx.RequestTask | never}
 */
export const exportCode = (params) => {
  return axios.request({
    url: 'Gift/export',
    method: 'get',
    params: params,
    responseType: 'arraybuffer'
  })
}

export const buildCode = (params) => {
  return axios.request({
    url: 'Gift/buildCode',
    method: 'get',
    params
  })
}

export const add = (data) => {
  return axios.request({
    url: 'Gift/add',
    method: 'post',
    data
  })
}

export const edit = (data) => {
  return axios.request({
    url: 'Gift/edit',
    method: 'post',
    data
  })
}
